/*
 * //Author: Karthic Kumar Sekar [A0092622]
 */

package sg.edu.nus.iss.team4ft.service;

import java.io.IOException;
import java.io.Serializable;
import java.util.Date;

import sg.edu.nus.iss.team4ft.exception.InvalidOperationException;
import sg.edu.nus.iss.team4ft.util.AppConstant;

public class MobileVoice extends VoicePlan  implements Serializable  {

	private static final long serialVersionUID = 1L;

	protected MobileVoice(MobileVoice mobileVoice) {
		super(mobileVoice);
	}
	
	public MobileVoice(Date startDate) throws InvalidOperationException, IOException, ClassNotFoundException {
		super(startDate, PlanCode.MobileVoice);
		super.setServiceName(AppConstant.MOBILE_VOICE_PLAN);		
	}
	
	@Override
	public void subscripeNewFeature(Feature feature)
			throws InvalidOperationException {
		//DigitalVoice will allow only feature of following type
		if(feature.getFeatureCode() == FeatureCode.LocalCall ||
				feature.getFeatureCode() == FeatureCode.InternationalCall ||
				feature.getFeatureCode() == FeatureCode.DataService||
				feature.getFeatureCode() == FeatureCode.RoamingCall)
			super.subscripeNewFeature(feature);
		else
			throw new InvalidOperationException("Feature '" + feature.getFeatureCode().toString() + "' cannot be added to plan'"+ this.getPlanCode().toString() + "'");
	}
	
	@Override
	public MobileVoice clone() throws CloneNotSupportedException {
		MobileVoice m = new MobileVoice(this);
		return m;
	}

}
